package com.woniu.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.woniu.vo.PositionAndCompany;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

public interface PositionAndCompanyMapper extends BaseMapper<PositionAndCompany> {
    /**
     * @Author Lints
     * @Date 2021/3/7/007 20:48
     * @Description 查询职位公司信息
     * @Param
     * @Return
     * @Since version-1.0
     */

    @Select("select p.position_id,\n" +
            "p.tname,\n" +
            "p.second_cid,\n" +
            "p.description,\n" +
            "p.salary,\n" +
            "p.lasalary,\n" +
            "p.address,\n" +
            "p.statusc,\n" +
            "c.company_id,\n" +
            "c.`name`,\n" +
            "c.industry,\n" +
            "c.`status`,\n" +
            "c.logo,\n" +
            "u.username,\n" +
            "u.id\n" +
            "from t_position p\n" +
            "join t_user_position up\n" +
            "on p.position_id=up.pid\n" +
            "join t_user_company uc \n" +
            "on uc.user_id=up.uid\n" +
            "join t_company c\n" +
            "on c.company_id=uc.company_id\n" +
            "join t_user u\n" +
            "on u.id=uc.user_id\n" +
            "${ew.customSqlSegment}\n")
    public IPage<PositionAndCompany> getPositionAndCompany(Page<PositionAndCompany> page,QueryWrapper<PositionAndCompany> ew);
}
